import game.Game;
import game.io.TagIO;

import java.io.*;

import room.*;
import commands.*;

public class TestGame2
{
	public static void main(String[] args)
	{
		Game game = new Game();
		TagIO t = new TagIO();

		Room newRoom = game.createRoom();
		game.setCurrentRoom(newRoom);
		newRoom.setName("The Adventurously Verdant Forest");

		Room newRoom2 = game.createRoom();
		newRoom2.setName("The Cave of Infinite Sorrow");
		
		RoomState newState = newRoom.getCurrentState();
		newState.setDescription("You are standing in the brush of a vast, leafy forest. Not even a ray of sunlight peeks through the canopy. Hey, I wonder what would happen if you lit a match... perhaps by saying 'light'?\n");

		RoomState newState2 = newRoom.createRoomState();
		newState2.setDescription("The greenery lays about you in grey ashes. Despite the vastness of this once-forest, you are now quite visible to several angry grues.\n");

		Commands temp;

		temp = newState.addVerb("look");
		temp.add(new SayDescription(newState));
		temp.add(new Say("There is a cave to the North.\n"));

		temp = newState.addVerb("light");
		temp.add(new Say("You have started a forest fire!\n"));
		temp.add(new ChangeState(newRoom, newState2.getId()));
		
		temp = newState.addVerb("north");
		temp.add(new Move(game, newRoom2));

		temp = newState2.addVerb("look");
		temp.add(new SayDescription(newState2));
		temp.add(new Say("There is a very appealing cave to the North.\n"));

		temp = newState2.addVerb("light");
		temp.add(new Say("Yeah right. Look where that got you.\n"));
		
		temp = newState2.addVerb("north");
		temp.add(new Move(game, newRoom2));

		RoomState newState3 = newRoom2.getCurrentState();
		newState3.setDescription("Bad Call. You have been eaten by a grue.\n");
		
		temp = newState3.addVerb("look");
		temp.add(new SayDescription(newState3));
	
		t.XMLout(game, new File("savegame.tag"));
		
		game = t.XMLin(new File("savegame.tag"));
		
		/*
		System.out.println("> look\n" + game.getCurrentRoom().executeVerb("look"));
		System.out.println("> light\n" + game.getCurrentRoom().executeVerb("light"));
		System.out.println("> look\n" + game.getCurrentRoom().executeVerb("look"));
		System.out.println("> light\n" + game.getCurrentRoom().executeVerb("light"));
		System.out.println("> north\n" + game.getCurrentRoom().executeVerb("north"));
		System.out.println(game.getCurrentRoom().getName());
		System.out.println("> look\n" + game.getCurrentRoom().executeVerb("look"));
		*/
	}
}